package game.objects.nonstaticObjects;

import java.util.Random;

import engine.game.Manager;
import engine.system.EDirection;
import game.entity.Entity;

public abstract class AIModel extends EntityModel{

	private static final long serialVersionUID = 1L;
	
	private static Random random = new Random(); 

	private int lastAction = 0 ; 
	private int actionTimer = 0 ; 
	
	public AIModel(Manager m, int x, int y, Entity e) {
		this(m, x, y, 20, 35, e);
	}
	public AIModel(Manager m, int x, int y, int w, int h, Entity e) {
		super(m, x, y, w, h, true, e);
	}
	public void update(){
		int action = random.nextInt(3); 
		if(lastAction != action && actionTimer > 100){
			lastAction = action ; 
			actionTimer = 0 ; 
		}else
			actionTimer++ ; 
		switch(lastAction){
		case 0: this.move(EDirection.LEFT); break ; 
		case 1: this.move(EDirection.RIGHT); break ;  
		case 2: this.enableJumping(); break ; 
		}
		super.update(); 
	}
	
}
